package com.fept.msgcore.msgserver.protocol.exception;

/**
 * Created by Srma on 1/13/2017.
 */
public class ProtocolException extends RuntimeException {
    /**
     *
     */
    private static final long serialVersionUID = -4363100410504575528L;

    /**
     * 默认情况是系统错误
     */
    private ProtocolErrorCodeEnum errorCode = ProtocolErrorCodeEnum.SYSTEM_ERROR;

    /**
     *
     * @param msg
     */
    public ProtocolException(String msg) {
        super(msg);
    }

    /**
     *
     * @param errorCode
     */
    public ProtocolException(ProtocolErrorCodeEnum errorCode) {
        this(errorCode.getCode(), errorCode);
    }

    /**
     *
     * @param msg
     * @param errorCode
     */
    public ProtocolException(String msg, ProtocolErrorCodeEnum errorCode) {
        super(msg);
        this.errorCode = errorCode;
    }

    /**
     * @return the errorCode
     */
    public ProtocolErrorCodeEnum getErrorCode() {
        return errorCode;
    }

    /**
     * @param errorCode
     *            the errorCode to set
     */
    public void setErrorCode(ProtocolErrorCodeEnum errorCode) {
        this.errorCode = errorCode;
    }
}
